package com.tsfyun.scm.vo.finance;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.tsfyun.common.base.enums.finance.CounterFeeTypeEnum;
import com.tsfyun.common.base.enums.finance.PaymentTermEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Optional;

@Data
public class EditPaymentVO implements Serializable {

    private Long id;
    private Long customerId;//客户ID
    private String customerName;//客户名称
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "GMT+8")
    private LocalDateTime accountDate;//申请时间
    private BigDecimal exchangeRate;//付汇汇率
    private BigDecimal accountValue;//付款金额
    private BigDecimal accountValueCny;//付款金额(人民币)
    private String currencyId;//币制
    private String currencyName;//币制
    private Long payeeId;//收款人
    private String payeeName;//收款人
    private String paymentTerm;//付款方式
    private String counterFeeType;//手续费承担方式
    private Long payeeBankId;//收款银行
    private String payeeBankName;//收款银行
    private String payeeBankAccountNo;//收款账号
    private String swiftCode;//SWIFT CODE
    private String ibankCode;//IBANK CODE
    private String payeeBankAddress;//收款行地址
    private String goodsRateTime;//汇率时间

    private String memo;

    private String paymentTermName;
    private String counterFeeTypeName;

    public String getPaymentTermName() {
        PaymentTermEnum paymentTermEnum = PaymentTermEnum.of(paymentTerm);
        return Optional.ofNullable(paymentTermEnum).map(PaymentTermEnum::getName).orElse("");
    }

    public String getCounterFeeTypeName() {
        CounterFeeTypeEnum counterFeeTypeEnum =  CounterFeeTypeEnum.of(counterFeeType);
        return Optional.ofNullable(counterFeeTypeEnum).map(CounterFeeTypeEnum::getName).orElse("");
    }
}
